package skipass.command;

import java.util.Calendar;

import skipass.CardStatSystem;
import skipass.DateUtil;
import skipass.WeekDayType;
import skipass.container.Card;

public class CheckWeekDayType implements Command {

	private Card card;
	private CardStatSystem css;
	
	public CheckWeekDayType(Card card, CardStatSystem css) {
		this.card = card;
		this.css = css;
	}
	
	@Override
	public boolean execute() {	
		Calendar cal = css.getCurrentTime();
		if (card.getType().getWeekDayType() == WeekDayType.WORKDAY) {
			if (!(DateUtil.isWeekend(cal))) {
				return true;
			}
		} else if (card.getType().getWeekDayType() == WeekDayType.WEEKEND) {
			if ((DateUtil.isWeekend(cal))) {
				return true;
			}
		} else if (card.getType().getWeekDayType() == WeekDayType.ALL) {
			return true;
		}
		return false;
	}

}
